package com.easyfile.easyfilemaster.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * 文件信息详细
 * @author chenpeman
 * @date 2022年05月06日 15:45
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName("file")
public class FileDetail {
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;
    private String name;
    private String type;
    private Integer typeId;
    private Double size;
    private String md5;
    private String uri;
    private String thu_url;
    private Long userId;
    private Long referenced;
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;
    @Version
    private Long version;
    @TableLogic
    private Integer deleted;

    public FileInfo toFileInfo(){
        return new FileInfo(id,name,type,typeId,size,createTime,updateTime);
    }
}
